import { getToken } from '@/utils/auth'
import { message } from 'antd'
import React from 'react'
import { useNavigate } from 'react-router-dom'

export default function AuthRoute({ children }) {
  const navigate = useNavigate()
  if (getToken()) {
    return <>{children}</>
  } else {
    navigate('/login')
  }
}
